<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:71:"D:\wwwroot\cms\template/admin_style/layui/admin/index/model/echarts.htm";i:1609243498;}*/ ?>
<!-- 用户组统计 -->
		  <section class="panel">
					  <header class="panel-heading bm0">
						   <span class='span-title'>网站信息统计</span>
						   <span class="tools pull-right"><a href="javascript:;" class="iconpx-chevron-down"></a></span>
					  </header>
					  <div class="panel-body laery-seo-box">
							<div class="larry-seo-stats" id="larry-seo-stats"></div>
					  </div>
		  </section>
<script type="text/javascript" src="/public/static/larry_layui/jsplug/echarts.min.js"></script>
<!--<script type="text/javascript" src="/public/static/larry_layui/js/main.js"></script>-->
<script type="text/javascript">
<?php 
$array = [];
$_array = query('memberdata',['group'=>'groupid','field'=>['count(uid)'=>'NUM','groupid']]);
foreach($_array AS $rs){
	$array[$rs['groupid']] = $rs['NUM'];
}
$group_array = getGroupByid();
 ?>
var myChart = echarts.init(document.getElementById('larry-seo-stats'));
option = {
    title : {
        text: '用户组成员统计',
        subtext: '按用户组来统计',
        x:'center'
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        left: 'left',
        data: ['<?php echo implode("','",$group_array); ?>']
    },
    series : [
        {
            name: '用户比例',
            type: 'pie',
            radius : '55%',
            center: ['50%', '60%'],
            data:[
			<?php if(is_array($group_array) || $group_array instanceof \think\Collection || $group_array instanceof \think\Paginator): $i = 0; $__LIST__ = $group_array;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$rs): $mod = ($i % 2 );++$i;?>
                {value:<?php echo (isset($array[$key]) && ($array[$key] !== '')?$array[$key]:0); ?>, name:'<?php echo $rs; ?>'},
			<?php endforeach; endif; else: echo "" ;endif; ?>
            ],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
};
myChart.setOption(option);
</script>